% /*******************************************************************************
%  * Main Simulation Routine
%  * *****************************************************************************
%  * @param lower
%  * @param upper
%  * @param m
%  * @param n
%  * @param r
%  * @param k
%  * @param q
%  * @param t
%  * @param z
%  */
function [avg_err_vct, avg_err_hct] = get_ev_vhct(lower,upper,m,n,r,k,p)

step_a = 2^(-m);
step_b = 2^(-n);
avg_err_vct = 0.0;
avg_err_hct = 0.0;
for a = lower:step_a:upper
    ia = floor((a - lower)/step_a) + 1;
    for b = lower:step_b:upper
        ib = floor((b-lower)/step_b) + 1;
        ans_true = a * b;
        %ans_trunc = trunc_mult(a,b,f,m,n,r,k); 
        [ans_eric, corr_eric] = vcm(a, b, m, n, r, k);
        [ans_hyb, corr_hyb] = hcm(a, b, m, n, r, k, 0.8);
        err_vct = abs(ans_true - ans_eric);
        err_hct = abs(ans_true - ans_hyb);
        weight_err_vct = err_vct * p(ia) * p(ib);
        avg_err_vct = avg_err_vct + weight_err_vct;
        weight_err_hct = err_hct * p(ia) * p(ib);
        avg_err_hct = avg_err_hct + weight_err_hct;
        
    end
end

end